package com.dure.commonlib.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Created by dure on 16-5-28.
 */
public class DateUtil {

    public static boolean beforeCurrentDate(String dateStr){
        Date date = convertStrToDate(dateStr);
        Date currentDate = convertStrToDate(TimeUtils.getCurrentTimeInString(TimeUtils.DATE_FORMAT_DATE));

        return date.before(currentDate);
    }

    public static Date convertStrToDate(String dateStr){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = null;
        try {
            date = sdf.parse(dateStr);
        } catch (ParseException e) {
            e.printStackTrace();
        }

        return date;
    }


}
